<?php
// 主页
namespace Admin\Controller;

use Think\Controller;

class CommonController extends Controller {
	public function _initialize() {
		$whiteLists = array (
				'1' 
		);
		$uid = get_cookie ( 'uid' );
		if (! $uid) {
			$this->error ( '请登以管理员账号登录' );
		}
		if (! in_array ( $uid, $whiteLists )) {
			$this->error ( '无权操作', '/' );
		}
	}
	
	// 循环创建目录
	protected function _mkDir($dir, $mode = 0777) {
		if (is_dir ( $dir ) || mkdir ( $dir, $mode ))
			return true;
		if (! $this->_mkDir ( dirname ( $dir ), $mode ))
			return false;
		return mkdir ( $dir, $mode );
	}
}